package com.atguigu.gulimall.auth.controller;

import com.atguigu.common.utils.HttpUtils;
import com.sun.deploy.net.HttpResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.HashMap;
import java.util.Map;

import static com.atguigu.common.utils.HttpUtils.doPost;

/**
 * 处理社交登录请求
 * @Author: WackyBoy
 * @Date: 2021/7/10 16:13
 */

@Controller
public class OAuth2Controller {

    @GetMapping("/oauth2.0/weibo/success")
    public String weibo() throws Exception {

        Map<String, String> map = new HashMap<>();
        // 1. 根据code换取token
        HttpResponse post = (HttpResponse) doPost("api.weibo.com", "/oauth2.0/access_token", "post", null, null, map);

        return "";
    }

}
